package com.example.zuoye.service.impl;

import com.example.zuoye.dao.BookDAO;
import com.example.zuoye.entity.Book;
import com.example.zuoye.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookDAO bookDAO;

    @Override
    public Book selectBookInfoByNameAndAuthor(String book_name, String book_author) {
        return bookDAO.selectBookInfoByNameAndAuthor(book_name,book_author);
    }

    @Override
    public Book selectBookInfoByName(String book_name) {
        return bookDAO.selectBookInfoByName(book_name);
    }

    @Override
    public List<Book> selectBookInfo() { return bookDAO.selectBookInfo(); }

    @Override
    public int insertBookInfo(String book_name,String book_author,String book_press,String book_date,Integer book_number,String book_image) {
        return bookDAO.insertBookInfo(book_name,book_author,book_press,book_date,book_number,book_image);
    }

    @Override
    public int deleteBookInfoByNameAndAuthor(String book_name, String book_author) {
        return bookDAO.deleteBookInfoByNameAndAuthor(book_name,book_author);
    }

    @Override
    public int deleteBookInfoById(Integer book_id) {
        return bookDAO.deleteBookInfoById(book_id);
    }

    @Override
    public int updateBookInfoById(Integer book_id,String book_name, String book_author, String book_press, String book_date, Integer book_number, String book_image) {
        return bookDAO.updateBookInfoById(book_id,book_name,book_author,book_press,book_date,book_number,book_image);
    }
}
